package week02.fruit;

/**
 * Created by zhangxiaokun on 2018/1/31.
 */
public class FruitGardener {

    public static Fruit factory(Class clazz) {
        if (Apple.class == clazz) {
            return new Apple();

        } else if (Grape.class == clazz) {
            return new Grape();
        }
        throw new RuntimeException("不支持此类型:" + clazz.getName());
    }

}
